package com.retail.member.controller;

import com.retail.core.entity.result.Result;
import com.retail.member.client.OrderClient;
import com.retail.member.entity.request.OrderStasticListRequest;
import com.retail.member.entity.vo.RetailOrderResVo;
import com.retail.member.entity.vo.RetailOrderStasticResVo;
import com.retail.order.entity.vo.RetailSettleOrderVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@Api(value = "订单页面API", tags = "订单页面API")
@RestController
@RequestMapping("api/order")
public class OrderApiController {

    private final OrderClient orderClient;

    public OrderApiController(OrderClient orderClient) {
        this.orderClient = orderClient;
    }

    @ApiOperation("得到用户订单-自己订单")
    @GetMapping("findOwnerOrderByAdminId/{adminId}")
    public Result<List<RetailSettleOrderVo>> findOrderByAdminId(@PathVariable("adminId") String adminId) {
        return orderClient.findOwnerOrderByAdminId(adminId);
    }

    @ApiOperation("得到用户订单-统计")
    @GetMapping("findOwnerOrderStastic/{adminId}")
    public Result<List<RetailOrderStasticResVo>> findOwnerOrderStastic(@PathVariable("adminId") Long adminId) {
        return orderClient.findOwnerOrderStastic(adminId);
    }

    @ApiOperation("得到用户订单-统计List")
    @PostMapping("findOwnerOrderStasticList")
    public Result<List<RetailSettleOrderVo>> findOwnerOrderStasticList(@RequestBody OrderStasticListRequest request) {
        return orderClient.findOwnerOrderStasticList(request.getAdminId(), request.getOrderType(), request.getSearch());
    }

    @ApiOperation("我的订单LIST")
    @PostMapping("myOrderList")
    public Result<List<RetailSettleOrderVo>> myOrderList(@RequestBody OrderStasticListRequest request) {
        return orderClient.myOrderList(request);
    }

    @ApiOperation("订单详情")
    @GetMapping("orderDetail/{orderId}")
    public Result<RetailOrderResVo> orderDetail(@PathVariable("orderId") Long orderId) {
        return orderClient.orderDetail(orderId);
    }


//    @ApiOperation("得到用户订单-所有订单（包含下级用户）")
//    @GetMapping("findAllOrderByAdminId/{adminId}")
//    public Result<RetailSettleOrderVo> findAllOrderByAdminId(@PathVariable("adminId") String adminId) {
//        return orderClient.findAllOrderByAdminId(adminId);
//    }

//    @ApiOperation("得到用户订单-商户订单（自身）")
//    @GetMapping("findOwnerShopOrderByAdminId/{adminId}")
//    public Result<RetailSettleOrderVo> findOwnerShopOrderByAdminId(@PathVariable("adminId") String adminId) {
//        return orderClient.findOwnerShopOrderByAdminId(adminId);
//    }
//
//    @ApiOperation("得到用户订单-商户订单（包含下级用户）")
//    @GetMapping("findOwnerShopOrderByAdminId/{adminId}")
//    public Result<RetailSettleOrderVo> findOwnerShopOrderByAdminId(@PathVariable("adminId") String adminId) {
//        return orderClient.findOwnerShopOrderByAdminId(adminId);
//    }

}
